﻿<UserControl x:Class="Peter.Interface.FileExplorerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:Logic="clr-namespace:Peter.Logic"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
   <Grid>
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto" />
         <RowDefinition Height="*" />
      </Grid.RowDefinitions>

      <!--ToolBar Grid.Row="0" ToolBarTray.IsLocked="True">
         <ToggleButton ToolTip="Sync with current editor">
            <Image Source="pack://application:,,,/Peter.Plugins;component/Images/SyncCurrentFile.png" />
         </ToggleButton>
      </ToolBar-->

      <TreeView Grid.Row="1"
                x:Name="_TreeMain"
                ItemsSource="{Binding Path=BaseItems}">
         <TreeView.ItemContainerStyle>
            <Style TargetType="{x:Type TreeViewItem}">
               <Setter Property="IsExpanded"
                       Value="{Binding IsExpanded, Mode=TwoWay}" />
               <Setter Property="IsSelected"
                       Value="{Binding IsSelected, Mode=TwoWay}" />
               <Setter Property="FontWeight"
                       Value="Normal" />
               <Style.Triggers>
                  <Trigger Property="IsSelected"
                           Value="True">
                     <Setter Property="FontWeight"
                             Value="Bold" />
                  </Trigger>
               </Style.Triggers>
            </Style>
         </TreeView.ItemContainerStyle>

         <TreeView.Resources>
            <HierarchicalDataTemplate DataType="{x:Type Logic:FileItemViewModel}"
                                      ItemsSource="{Binding Children}">
               <StackPanel Orientation="Horizontal">
                  <Image Width="14"
                         Height="14"
                         Margin="3,0"
                         Source="{Binding Path=IconSource}" />
                  <TextBlock Text="{Binding Path=Text}"
                             Margin="0, 0, 0, 4" />
               </StackPanel>
            </HierarchicalDataTemplate>
            
         </TreeView.Resources>
      </TreeView>
   </Grid>
</UserControl>
